In a magnetic disk device, when data is written, a so-called “side erase” may occur due to adjacent track interference (ATI) such as, for example, a leakage of magnetic flux from a head. The “ATI” differs depending on, for example, the characteristics of the head, a track-per-inch (TPI) setting value, and a write current setting value. In order to prevent the side erase due to the ATI, the magnetic disk device has a function of rewriting data (known as refresh function) in a predetermined track before the number of times of writing data (the number of write times) to a peripheral track of the predetermined track reaches an upper limit at which the side erase does not occur due to ATI.